package o;

import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.RemoteBuoyAction;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol.Request;
import com.huawei.fastengine.fastview.FastSDKEngine;
import com.huawei.fastengine.fastview.startFastappEngine.bean.RpkInfo;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import com.huawei.gamebox.service.welfare.gift.bean.GiftCardBean;
import com.huawei.gamebox.service.welfare.gift.bean.PlayerRoleInfo;
import java.io.Serializable;
import java.util.List;
import java.util.Locale;

public class fcl {
    public static void ˋ(Context context, String str, String str2) {
        if (!ॱ(context)) {
            cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
            Request request = new Request(str, null);
            request.ᐝ(str2);
            appDetailActivityProtocol.ˏ(request);
            cjm o_cjm = new cjm("appdetail.activity", appDetailActivityProtocol);
            if (!(context instanceof Activity)) {
                Logger.ˎ("GiftUtils", "!(context instanceof Activity)");
                o_cjm.ॱ().setFlags(268435456);
            }
            cjk.ˎ().ˋ(context, o_cjm);
        }
    }

    public static boolean ॱ(Context context) {
        if (context != null && (!(context instanceof Activity) || !((Activity) context).isFinishing())) {
            return false;
        }
        Logger.e("GiftUtils", "context is null");
        return true;
    }

    public static String ॱ(int i) {
        if (-1 < i) {
            return ContentManager.getInstant().getContext().getString(i);
        }
        return null;
    }

    public static String ॱ(int i, String str) {
        if (-1 >= i) {
            return null;
        }
        return ContentManager.getInstant().getContext().getString(i, new Object[]{str});
    }

    public static String ˊ(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        return str.toUpperCase(Locale.getDefault());
    }

    public static boolean ˏ(Context context, String str, String str2, int i) {
        if (eyk.ˊ(str)) {
            Logger.ˏ("GiftUtils", "Utils.isH5Game(appId)");
            return true;
        } else if (ˋ(i)) {
            Logger.ˏ("GiftUtils", "fast app gift");
            return true;
        } else if (TextUtils.isEmpty(str2) || !cep.ˋ(context, str2)) {
            return false;
        } else {
            return true;
        }
    }

    public static void ˋ(String str, Context context) {
        ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService("clipboard");
        if (clipboardManager != null) {
            clipboardManager.setPrimaryClip(ClipData.newPlainText(null, str));
        }
    }

    public static void ˊ(Context context, fcd o_fcd, int i) {
        if (ˊ(i)) {
            Intent intent = new Intent(context, TransferActivity.class);
            intent.setAction("com.huawei.gamebox.ACTION_GIFT_DIALOG");
            intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_PARAM, o_fcd);
            fam.ॱ().ˎ(context, TransferActivity.class, intent, false);
            return;
        }
        fcb.ˊ(context, o_fcd);
    }

    public static void ˏ(Context context, List<PlayerRoleInfo> list, GiftCardBean giftCardBean, int i) {
        if (ˊ(i)) {
            Intent intent = new Intent(context, TransferActivity.class);
            intent.setAction("com.huawei.gamebox.ACTION_GIFT_SELECT_ROLE_DIALOG");
            intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_PARAM, (Serializable) list);
            intent.putExtra("cardbean", giftCardBean);
            intent.putExtra("service_type", i);
            fam.ॱ().ˎ(context, TransferActivity.class, intent, false);
            return;
        }
        fcb.ˎ(context, list, giftCardBean, i);
    }

    public static boolean ˋ(int i) {
        return i == 3;
    }

    public static void ˎ(int i) {
        ˎ(ॱ(i));
    }

    public static void ˎ(String str) {
        eyh.ॱ(str);
    }

    public static boolean ˊ(int i) {
        return 4 == i;
    }

    public static void ॱ(Context context, GiftCardBean giftCardBean) {
        if (ˋ(giftCardBean.ˊᐝ())) {
            RpkInfo rpkInfo = new RpkInfo();
            rpkInfo.setPackageName(giftCardBean.ॱـ());
            FastSDKEngine.launchFastAppFromAppGallery(context, rpkInfo);
            return;
        }
        ced.ˎ(context, giftCardBean.ॱـ(), giftCardBean.ᐝॱ());
    }
}
